<%@ include file="connect.jsp" %>

<%
    String namaGames = request.getParameter("gamesName");
    String sound = request.getParameter("sound");
    String category = request.getParameter("category");

    ResultSet rs = stat.executeQuery("Select * from games where lower(gamesName)=lower('" + namaGames + "') ");
    if (rs.next()) {

        response.sendRedirect("games.jsp?respon=Case's name has exist, please choose another name!");
    } else {

        String sql = "INSERT INTO Games (categoryID,gamesName, sound) values ('" + category + "','" + namaGames + "', '" + sound + "')";
        stat.executeUpdate(sql);
        response.sendRedirect("games.jsp?respon=New case has been added!");
    }

    conn.close();

%>